//
//  ViewController.m
//  CoreAnimation
//
//  Created by aron on 2017/5/23.
//  Copyright © 2017年 aron. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    CALayer *blueLayer = [CALayer layer];
    blueLayer.frame = CGRectMake(50.0f, 50.0f, 100.0f, 150.0f);
    blueLayer.backgroundColor = [UIColor blueColor].CGColor;
    // CALayer添加图片内容
    blueLayer.contents = (__bridge id _Nullable)([UIImage imageNamed:@"me-blog"].CGImage);
    // CALayer设置显示模式，类似UIView的contentMode
    blueLayer.contentsGravity = kCAGravityCenter;
     blueLayer.contentsScale = [UIScreen mainScreen].scale;
    [self.view.layer addSublayer:blueLayer];
    
    
    UIImageView* imageView = [[UIImageView alloc] initWithFrame:CGRectMake(150, 50, 100, 150)];
    imageView.image = [UIImage imageNamed:@"me-blog"];
    imageView.contentMode = UIViewContentModeCenter;
    imageView.backgroundColor = [UIColor grayColor];
    [self.view addSubview:imageView];
    
    
    UIImageView* vioceBubbleImageView = [[UIImageView alloc] initWithFrame:CGRectMake(50, 250, 150, 50)];
    vioceBubbleImageView.image = [UIImage imageNamed:@"voice_3"];
    [self.view addSubview:vioceBubbleImageView];
    
    UIImageView* vioceCapBubbleImageView = [[UIImageView alloc] initWithFrame:CGRectMake(200, 250, 150, 50)];
    vioceCapBubbleImageView.image = [[UIImage imageNamed:@"voice_3"]  resizableImageWithCapInsets:UIEdgeInsetsMake(0.5f, 0.5f, 0.25f, 0.25f)];
    [self.view addSubview:vioceCapBubbleImageView];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
